<?php
namespace Admin\Controller;
use Common\Controller\AdminController;

class CsshController extends AdminController{
     
	public function index(){
		$where = '1=1';
		$where .= I('get.name') ? ' and name like "%' . I('get.name') . '%"' : '';
		$where .= I('get.cslb_id') > 0 ? ' and cslb_id=' . I('get.cslb_id', 0, 'intval') : '';
		$where .= I('get.csxm_id') > 0 ? ' and csxm_id=' . I('get.csxm_id', 0, 'intval') : '';
		$where .= I('get.shenhe_zt', -1) > -1 ? ' and shenhe_zt =' . I('get.shenhe_zt') : '';	
	    $list = $this->getList('*', 'ssgl_sq', $where, 'id desc', true);
		$this->assign('list', $list);	
		$groupList = $this->getList('id,name', 'ssgl_cslb');
		$this->assign('groupList', $groupList);
		$classifyList = $this->getList('id,name', 'ssgl_csxm');
		$this->assign('classifyList', $classifyList);
		$this->display();
	}
	public function shenhe(){
		 if(IS_POST){
		 	$_POST['shrq_act']=strtotime($_POST['shrq_act']);
		    $_POST['shrq_xb']=strtotime($_POST['shrq_xb']);
			$result = $this->updateData($_POST, 'ssgl_sq',2);
			$this->returnResult($result);
		}else{
			$info = $this->getInfo('*', 'ssgl_sq', array('id' => I('get.id', 0, 'intval')));
			$this->assign('info', $info);
			$this->display();
		}	
	}
}